home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD 54 / SuperCd54.iso / microsoft / MicrosoftReader / MSWordREaderAddIn / Microsoft Download Center_files / toolbar.js < prev   
Encoding:
Text File  |  2001-06-12  |  21.0 KB  |  766 lines

  1. var ToolBar_Supported = false;
  2. var Frame_Supported   = false;
  3. var DoInstrumentation = false;
  4. var doImage = doImage;
  5. var TType = TType;
  6.  
  7. if (navigator.userAgent.indexOf("MSIE")    != -1 && 
  8.     navigator.userAgent.indexOf("Windows") != -1 && 
  9.     navigator.appVersion.substring(0,1) > 3)
  10. {
  11.     ToolBar_Supported = true;
  12. }
  13.  
  14. if(doImage == null)
  15. {
  16.     var a= new Array();
  17.     a[0] = prepTrackingString(window.location.hostname,7);
  18.     if (TType == null)
  19.     {    
  20.         a[1] = prepTrackingString('PV',8);
  21.     }
  22.     else
  23.     {
  24.         a[1] = prepTrackingString(TType,8);
  25.     }
  26.     a[2] = prepTrackingString(window.location.pathname,0);
  27.     if(window.location.search != '')
  28.     {
  29.         a[a.length] = prepTrackingString(window.location.search,1);
  30.     }
  31.     if( '' != window.document.referrer)
  32.     {
  33.         a[a.length] = prepTrackingString(window.document.referrer,5);
  34.     }
  35.     
  36.     if (navigator.userAgent.indexOf("SunOS") == -1 && navigator.userAgent.indexOf("Linux") == -1)
  37.     {
  38.         buildIMG(a);
  39.     }
  40. }    
  41.  
  42.     
  43. if (ToolBar_Supported)
  44. {
  45.     
  46.     var newLineChar = String.fromCharCode(10);
  47.     var char34 = String.fromCharCode(34);
  48.     var LastMSMenu = "";
  49.     var CurICPMenu = "";
  50.     var IsMSMenu = false;
  51.     var IsMenuDropDown = true;
  52.     var HTMLStr;
  53.     var x = 0;
  54.     var y = 0;
  55.     var x2 = 0;
  56.     var y2 = 0;
  57.     var MSMenuWidth;
  58.     var ToolbarMinWidth;
  59.     var ToolbarMenu;
  60.     var ToolbarBGColor;
  61.     var ToolbarLoaded = false;
  62.     var aDefMSColor  = new Array(3);
  63.     var aDefICPColor = new Array(3);
  64.     var aCurMSColor  = new Array(3);
  65.     var aCurICPColor = new Array(3);
  66.     var MSFont;
  67.     var ICPFont;
  68.     var MaxMenu = 30;
  69.     var TotalMenu = 0;
  70.     var arrMenuInfo = new Array(30);
  71.     
  72.     // Output style sheet and toolbar ID
  73.     document.write("<SPAN ID='StartMenu' STYLE='display:none;'></SPAN>");
  74.  
  75.     // Build toolbar template
  76.     HTMLStr = 
  77.         "<DIV ID='idToolbar'     STYLE='background-color:white;width:100%'>" +
  78.         "<DIV ID='idRow1'        STYLE='position:relative;height:20;'>" +
  79.         "<DIV ID='idICPBanner'   STYLE='position:absolute;top:0;left:0;height:60;width:250;overflow:hidden;vertical-align:top;'><!--BEG_ICP_BANNER--><!--END_ICP_BANNER--></DIV>" +
  80.         "<DIV ID='idMSMenuCurve' STYLE='position:absolute;top:0;left:250;height:20;width:18;overflow:hidden;vertical-align:top;'><IMG SRC='/library/toolbar/images/curve.gif' BORDER=0></DIV>" +
  81.         "<DIV ID='idMSMenuPane'  STYLE='position:absolute;top:0;left:250;height:20;width:10;background-color:black;float:right;' NOWRAP><!--MS_MENU_TITLES--></DIV>" + 
  82.         "</DIV>" +
  83.         "<DIV ID='idRow2' STYLE='position:relative;left:250;height:40;'>" +
  84.         "<DIV ID='idADSBanner'   STYLE='position:absolute;top:0;left:0;height:40;width:200;vertical-align:top;overflow:hidden;'><!--BEG_ADS_BANNER--><!--END_ADS_BANNER--></DIV>" +
  85.         "<DIV ID='idMSCBanner'   STYLE='position:absolute;top:0;left:200;height:40;width:112;vertical-align:top;overflow:hidden;' ALIGN=RIGHT><!--BEG_MSC_BANNER--><!--END_MSC_BANNER--></DIV>" +
  86.         "</DIV>" +
  87.         "<DIV ID='idRow3' STYLE='position:relative;height:20;width:100%'>" +
  88.         "<DIV ID='idICPMenuPane' STYLE='position:absolute;top:0;left:0;height:20;background-color:black;' NOWRAP><!--ICP_MENU_TITLES--></DIV>" +
  89.         "</DIV>" +
  90.         "</DIV>" + 
  91.         "<SCRIPT TYPE='text/javascript'>" + 
  92.         "   var ToolbarMenu = StartMenu;" + 
  93.         "</SCRIPT>" + 
  94.         "<DIV WIDTH=100%>";
  95.  
  96.     // Define event handlers
  97.     window.onresize  = resizeToolbar;
  98.  
  99.     // Intialize global variables
  100.     ToolbarBGColor    = "white";                        // toolbar background color
  101.     MSFont  = "xx-small Verdana";
  102.     ICPFont = "bold xx-small Verdana";
  103.     
  104.     aDefMSColor[0]    = aCurMSColor[0]  = "black";    // bgcolor;
  105.     aDefMSColor[1]    = aCurMSColor[1]  = "white";    // text font color
  106.     aDefMSColor[2]  = aCurMSColor[2]  = "red";        // mouseover font color
  107.     
  108.     aDefICPColor[0]    = aCurICPColor[0] = "#6699CC";    // bgcolor;
  109.     aDefICPColor[1] = aCurICPColor[1] = "white";    // text font color
  110.     aDefICPColor[2] = aCurICPColor[2] = "red";        // mouseover font color
  111. }
  112.  
  113. // The hard-coded numbers in functions - drawToolbar() & resizeToolbar()
  114. // correspond to the dimension of the four gif files:
  115. //        ICP_BANNER: 60h x 250w
  116. //        ADS_BANNER: 40h x 200w
  117. //        MSC_BANNER: 40h x 112w
  118. //        Curve:        20h x 18w
  119.  
  120. function drawToolbar()
  121. {
  122.     HTMLStr += "</DIV>";
  123.     document.write(HTMLStr);
  124.     ToolbarLoaded = true;
  125.  
  126.     MSMenuWidth     = Math.max(idMSMenuPane.offsetWidth, (200+112));
  127.     ToolbarMinWidth = (250+18) + MSMenuWidth;
  128.  
  129.     idToolbar.style.backgroundColor     = ToolbarBGColor;
  130.     idMSMenuPane.style.backgroundColor  = aDefMSColor[0];
  131.     idICPMenuPane.style.backgroundColor = aDefICPColor[0];
  132.     resizeToolbar();
  133.  
  134.     for (i = 0; i < TotalMenu; i++) 
  135.     {
  136.         thisMenu = document.all(arrMenuInfo[i].IDStr);
  137.         if (thisMenu != null)
  138.         {
  139.             if (arrMenuInfo[i].IDStr == LastMSMenu && arrMenuInfo[i].type == "R")
  140.             {
  141.                 //Last MSMenu has to be absolute width
  142.                 arrMenuInfo[i].type = "A";
  143.                 arrMenuInfo[i].unit = 200;
  144.             }
  145.             if (arrMenuInfo[i].type == "A")
  146.                 thisMenu.style.width = arrMenuInfo[i].unit;
  147.             else 
  148.                 thisMenu.style.width = Math.round(arrMenuInfo[i].width * arrMenuInfo[i].unit) + 'em';
  149.         }
  150.     }
  151. }
  152.  
  153. function resizeToolbar()
  154. {
  155.     if (ToolBar_Supported == false) return;
  156.  
  157.     w = Math.max(ToolbarMinWidth, document.body.clientWidth) - ToolbarMinWidth;
  158.     
  159.     idMSMenuCurve.style.left  = (250+w);
  160.     idMSMenuPane.style.left   = (250+w+18);
  161.     idMSMenuPane.style.width  = MSMenuWidth;
  162.  
  163.     idADSBanner.style.left    = (w+18);
  164.  
  165.     idMSCBanner.style.left    = (w+18+200);
  166.     idMSCBanner.style.width   = (MSMenuWidth - 200);
  167.     
  168.     idICPMenuPane.style.width = ToolbarMinWidth + w;
  169. }
  170.  
  171. function setToolbarBGColor(color)
  172. {    
  173.     ToolbarBGColor = color;
  174.     if (ToolbarLoaded == true)
  175.         idToolbar.style.backgroundColor = ToolbarBGColor;
  176. }    
  177.  
  178. function setMSMenuFont(sFont)
  179. {    MSFont = sFont;
  180. }
  181.  
  182. function setICPMenuFont(sFont)
  183. {    ICPFont = sFont;
  184. }
  185.  
  186. function setDefaultMSMenuColor(bgColor, fontColor, mouseoverColor)
  187. {    
  188.     if (bgColor   != "")      aDefMSColor[0] = bgColor;
  189.     if (fontColor != "")      aDefMSColor[1] = fontColor;
  190.     if (mouseoverColor != "") aDefMSColor[2] = mouseoverColor;
  191. }
  192.  
  193. function setDefaultICPMenuColor(bgColor, fontColor, mouseoverColor)
  194. {    
  195.     if (bgColor   != "")      aDefICPColor[0] = bgColor;
  196.     if (fontColor != "")      aDefICPColor[1] = fontColor;
  197.     if (mouseoverColor != "") aDefICPColor[2] = mouseoverColor;
  198. }
  199.  
  200. function setICPMenuColor(MenuIDStr, bgColor, fontColor, mouseoverColor)
  201. {    
  202.     if (ToolbarLoaded == false) return;
  203.  
  204.     // Reset previous ICP Menu color if any
  205.     if (CurICPMenu != "")
  206.     {
  207.         PrevID = CurICPMenu.substring(4);
  208.         CurICPMenu = "";
  209.         setICPMenuColor(PrevID, aDefICPColor[0], aDefICPColor[1], aDefICPColor[2]);
  210.     }
  211.  
  212.     var    id = "AM_" + "ICP_" + MenuIDStr;
  213.     var thisMenu = document.all(id);
  214.     if (thisMenu != null)
  215.     {
  216.         CurICPMenu = "ICP_" + MenuIDStr;
  217.         aCurICPColor[0] = bgColor;
  218.         aCurICPColor[1] = fontColor;
  219.         aCurICPColor[2] = mouseoverColor;
  220.  
  221.         // Change menu color
  222.         if (bgColor != "")
  223.             thisMenu.style.backgroundColor = bgColor;
  224.         if (fontColor != "")
  225.             thisMenu.style.color = fontColor;
  226.  
  227.         // Change subMenu color
  228.         id = "ICP_" + MenuIDStr;
  229.         thisMenu = document.all(id);
  230.         if (thisMenu != null)
  231.         {
  232.             if (bgColor != "")
  233.                 thisMenu.style.backgroundColor = bgColor;
  234.             
  235.             if (fontColor != "")
  236.             {
  237.                 i = 0;
  238.                 id = "AS_" + "ICP_" + MenuIDStr;
  239.                 thisMenu = document.all.item(id,i);
  240.                 while (thisMenu != null)
  241.                 {
  242.                     thisMenu.style.color = fontColor;
  243.                     i += 1;
  244.                     thisMenu = document.all.item(id,i);
  245.                 }
  246.             }
  247.         }
  248.     }
  249. }
  250.  
  251. function setAds(Gif,Url,AltStr)
  252. {    setBanner(Gif,Url,AltStr,"<!--BEG_ADS_BANNER-->","<!--END_ADS_BANNER-->");
  253. }
  254.  
  255. function setICPBanner(Gif,Url,AltStr)
  256. {    setBanner(Gif,Url,AltStr,"<!--BEG_ICP_BANNER-->","<!--END_ICP_BANNER-->");
  257. }
  258.  
  259. function setMSBanner(Gif,Url,AltStr)
  260. {    tempGif = "/library/toolbar/images/" + Gif;
  261.     setBanner(tempGif,Url,AltStr,"<!--BEG_MSC_BANNER-->","<!--END_MSC_BANNER-->");
  262. }
  263.  
  264. function setBanner(BanGif, BanUrl, BanAltStr, BanBegTag, BanEndTag)
  265. {
  266.     begPos = HTMLStr.indexOf(BanBegTag);
  267.     endPos = HTMLStr.indexOf(BanEndTag) + BanEndTag.length;
  268.     
  269.     SubStr = HTMLStr.substring(begPos, endPos);
  270.     SrcStr = "";
  271.     if (BanUrl != "")
  272.         SrcStr += "<A Target='_top' HREF='" + formatURL(BanUrl, BanGif) + "'>";
  273.     SrcStr += "<IMG SRC='" + BanGif + "' ALT='" + BanAltStr + "' BORDER=0>";
  274.     if (BanUrl != "")
  275.         SrcStr += "</A>";
  276.     SrcStr = BanBegTag + SrcStr + BanEndTag;
  277.     HTMLStr = HTMLStr.replace(SubStr, SrcStr);    
  278. }
  279.  
  280. function setICPSubMenuWidth(MenuIDStr, WidthType, WidthUnit)
  281. {    tempID = "ICP_" + MenuIDStr;
  282.     setSubMenuWidth(tempID, WidthType, WidthUnit);
  283. }
  284.  
  285. function setMSSubMenuWidth(MenuIDStr, WidthType, WidthUnit)
  286. {    tempID = "MS_" + MenuIDStr;
  287.     setSubMenuWidth(tempID, WidthType, WidthUnit);
  288. }
  289.  
  290. function setSubMenuWidth(MenuIDStr, WidthType, WidthUnit)
  291. {
  292.     var fFound = false;
  293.     if (TotalMenu == MaxMenu)
  294.     {
  295.         alert("Unable to process menu. Maximum of " + MaxMenu + " reached.");
  296.         return;
  297.     }
  298.     
  299.     for (i = 0; i < TotalMenu; i++)
  300.         if (arrMenuInfo[i].IDStr == MenuIDStr)
  301.         {
  302.             fFound = true;
  303.             break;
  304.         }
  305.  
  306.     if (!fFound)
  307.     {
  308.         arrMenuInfo[i] = new menuInfo(MenuIDStr);
  309.         TotalMenu += 1;
  310.     }
  311.  
  312.     if (!fFound && WidthType.toUpperCase().indexOf("DEFAULT") != -1)
  313.     {
  314.         arrMenuInfo[i].type = "A";
  315.         arrMenuInfo[i].unit = 160;
  316.     }
  317.     else
  318.     {
  319.         arrMenuInfo[i].type = (WidthType.toUpperCase().indexOf("ABSOLUTE") != -1)? "A" : "R";
  320.         arrMenuInfo[i].unit = WidthUnit;
  321.     }
  322. }
  323.  
  324. // This function creates a menuInfo object instance.
  325. function menuInfo(MenuIDStr)
  326. {
  327.     this.IDStr = MenuIDStr;
  328.     this.type  = "";
  329.     this.unit  = 0;
  330.     this.width = 0;
  331.     this.count = 0;
  332. }
  333.  
  334. function updateSubMenuWidth(MenuIDStr)
  335. {
  336.     for (i = 0; i < TotalMenu; i++)
  337.         if (arrMenuInfo[i].IDStr == MenuIDStr)
  338.         {
  339.             if (arrMenuInfo[i].width < MenuIDStr.length) 
  340.                 arrMenuInfo[i].width = MenuIDStr.length;
  341.             arrMenuInfo[i].count = arrMenuInfo[i].count + 1;
  342.             break;
  343.         }
  344. }
  345.  
  346. function addICPMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr)
  347. {     
  348.     if (addICPMenu.arguments.length > 4)
  349.         TargetStr = addICPMenu.arguments[4];
  350.     else
  351.         TargetStr = "_top";
  352.     tempID = "ICP_" + MenuIDStr;
  353.     addMenu(tempID, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, true); 
  354. }
  355.  
  356. function addMSMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr)
  357. {    
  358.     TargetStr = "_top";
  359.     tempID = "MS_" + MenuIDStr;
  360.     addMenu(tempID, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, false); 
  361.     LastMSMenu = tempID;
  362. }
  363.  
  364. function addMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, bICPMenu)
  365. {
  366.     cFont   = bICPMenu? ICPFont : MSFont;
  367.     cColor0 = bICPMenu? aDefICPColor[0] : aDefMSColor[0];
  368.     cColor1 = bICPMenu? aDefICPColor[1] : aDefMSColor[1];
  369.     cColor2 = bICPMenu? aDefICPColor[2] : aDefMSColor[2];
  370.     tagStr  = bICPMenu? "<!--ICP_MENU_TITLES-->" : "<!--MS_MENU_TITLES-->";
  371.  
  372.     MenuStr = newLineChar;
  373.     if (bICPMenu == false && LastMSMenu != "")
  374.         MenuStr += "<SPAN STYLE='font:" + cFont + ";color:" + cColor1 + "'>| </SPAN>"; 
  375.     MenuStr += "<A TARGET='" + TargetStr + "' TITLE='" + MenuHelpStr + "'" +
  376.                "   ID='AM_" + MenuIDStr + "'" +
  377.                "   STYLE='text-decoration:none;cursor:hand;font:" + cFont + ";background-color:" + cColor0 + ";color:" + cColor1 + ";'";
  378.     if (MenuURLStr != "")
  379.     {
  380.         if (bICPMenu)
  381.             MenuStr += " HREF='" + formatURL(MenuURLStr, ("ICP_" + MenuDisplayStr)) + "'";
  382.         else
  383.             MenuStr += " HREF='" + formatURL(MenuURLStr, ("MS_" + MenuDisplayStr)) + "'";
  384.     }
  385.     else
  386.         MenuStr += " HREF='' onclick='window.event.returnValue=false;'";
  387.     MenuStr +=     " onmouseout="  + char34 + "mouseMenu('out' ,'" + MenuIDStr + "'); hideMenu();" + char34 + 
  388.                 " onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "'); doMenu('"+ MenuIDStr + "');" + char34 + ">" +
  389.                 " " + MenuDisplayStr + " </a>";
  390.     if (bICPMenu)
  391.         MenuStr += "<SPAN STYLE='font:" + cFont + ";color:" + cColor1 + "'> |</SPAN>";
  392.     MenuStr += tagStr;
  393.     
  394.     HTMLStr = HTMLStr.replace(tagStr, MenuStr);    
  395.     setSubMenuWidth(MenuIDStr,"default",0);
  396. }
  397.  
  398. function addICPSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr)
  399. {    
  400.     if (addICPSubMenu.arguments.length > 3)
  401.         TargetStr = addICPSubMenu.arguments[3];
  402.     else
  403.         TargetStr = "_top";
  404.     tempID = "ICP_" + MenuIDStr;
  405.     addSubMenu(tempID,SubMenuStr,SubMenuURLStr,TargetStr,true); 
  406. }
  407.  
  408. function addMSSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr)
  409. {    
  410.     TargetStr = "_top";
  411.     tempID = "MS_" + MenuIDStr;
  412.     addSubMenu(tempID,SubMenuStr,SubMenuURLStr,TargetStr,false); 
  413. }
  414.  
  415. function addSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr, TargetStr, bICPMenu)
  416. {
  417.     cFont   = bICPMenu? ICPFont : MSFont;
  418.     cColor0 = bICPMenu? aDefICPColor[0] : aDefMSColor[0];
  419.     cColor1 = bICPMenu? aDefICPColor[1] : aDefMSColor[1];
  420.     cColor2 = bICPMenu? aDefICPColor[2] : aDefMSColor[2];
  421.     
  422.     var MenuPos = MenuIDStr.toUpperCase().indexOf("MENU");
  423.     if (MenuPos == -1) { MenuPos = MenuIDStr.length; }
  424.     InstrumentStr = MenuIDStr.substring(0 , MenuPos) + "|" + SubMenuStr;;
  425.     URLStr        = formatURL(SubMenuURLStr, InstrumentStr);
  426.  
  427.     var LookUpTag  = "<!--" + MenuIDStr + "-->";
  428.     var sPos = HTMLStr.indexOf(LookUpTag);
  429.     if (sPos <= 0)
  430.     {
  431.         HTMLStr += newLineChar + newLineChar +
  432.                 "<SPAN ID='" + MenuIDStr + "'" +
  433.                 " STYLE='display:none;position:absolute;width:160;background-color:" + cColor0 + ";padding-top:0;padding-left:0;padding-bottom:20;z-index:9;'" +
  434.                 " onmouseout='hideMenu();'>";
  435.         if (Frame_Supported == false || bICPMenu == false)
  436.             HTMLStr += "<HR  STYLE='position:absolute;left:0;top:0;color:" + cColor1 + "' SIZE=1>";
  437.         HTMLStr += "<DIV STYLE='position:relative;left:0;top:8;'>";
  438.     }
  439.  
  440.     TempStr = newLineChar +
  441.                 "<A ID='AS_" + MenuIDStr + "'" +
  442.                 "   STYLE='text-decoration:none;cursor:hand;font:" + cFont + ";color:" + cColor1 + "'" +
  443.                 "   HREF='" + URLStr + "' TARGET='" + TargetStr + "'" +
  444.                 " onmouseout="  + char34 + "mouseMenu('out' ,'" + MenuIDStr + "');" + char34 + 
  445.                 " onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "');" + char34 + ">" +
  446.                 " " + SubMenuStr + "</A><BR>" + LookUpTag;
  447.     if (sPos <= 0)
  448.         HTMLStr += TempStr + "</DIV></SPAN>";
  449.     else
  450.         HTMLStr = HTMLStr.replace(LookUpTag, TempStr);    
  451.  
  452.     updateSubMenuWidth(MenuIDStr);    
  453. }
  454.  
  455. function addICPSubMenuLine(MenuIDStr)
  456. {    
  457.     tempID = "ICP_" + MenuIDStr;
  458.     addSubMenuLine(tempID,true);
  459. }
  460.  
  461. function addMSSubMenuLine(MenuIDStr)
  462. {    
  463.     tempID = "MS_" + MenuIDStr;
  464.     addSubMenuLine(tempID,false);
  465. }
  466.  
  467. function addSubMenuLine(MenuIDStr, bICPMenu)
  468. {
  469.     var LookUpTag = "<!--" + MenuIDStr + "-->";
  470.     var sPos = HTMLStr.indexOf(LookUpTag);
  471.     if (sPos > 0)
  472.     {
  473.         cColor  = bICPMenu? aDefICPColor[1] : aDefMSColor[1];
  474.         TempStr = newLineChar + "<HR STYLE='color:" + cColor + "' SIZE=1>" + LookUpTag;
  475.         HTMLStr = HTMLStr.replace(LookUpTag, TempStr);
  476.     }
  477. }
  478.  
  479. function mouseMenu(id, MenuIDStr) 
  480. {
  481.     IsMSMenu   = (MenuIDStr.toUpperCase().indexOf("MS_") != -1);
  482.     IsMouseout = (id.toUpperCase().indexOf("OUT") != -1);
  483.  
  484.     if (IsMouseout)
  485.     {
  486.         color = IsMSMenu? aDefMSColor[1] : aDefICPColor[1];
  487.         if (MenuIDStr == CurICPMenu && aCurICPColor[1] != "") 
  488.             color = aCurICPColor[1];
  489.     }
  490.     else
  491.     {
  492.         color = IsMSMenu? aDefMSColor[2] : aDefICPColor[2];
  493.         if (MenuIDStr == CurICPMenu && aCurICPColor[2] != "") 
  494.             color = aCurICPColor[2];
  495.     }
  496.     window.event.srcElement.style.color = color;
  497. }
  498.  
  499. function doMenu(MenuIDStr) 
  500. {
  501.     var thisMenu = document.all(MenuIDStr);
  502.     if (ToolbarMenu == null || thisMenu == null || thisMenu == ToolbarMenu) 
  503.     {
  504.         window.event.cancelBubble = true;
  505.         return false;
  506.     }
  507.     // Reset dropdown menu
  508.     window.event.cancelBubble = true;
  509.     ToolbarMenu.style.display = "none";
  510.     showElement("SELECT");
  511.     showElement("OBJECT");
  512.     ToolbarMenu = thisMenu;
  513.     IsMSMenu = (MenuIDStr.toUpperCase().indexOf("MS_") != -1);
  514.  
  515.     // Set dropdown menu display position
  516.     x  = window.event.srcElement.offsetLeft +
  517.           window.event.srcElement.offsetParent.offsetLeft;
  518.     if (MenuIDStr == LastMSMenu) 
  519.         x += (window.event.srcElement.offsetWidth - thisMenu.style.posWidth);
  520.     x2 = x + window.event.srcElement.offsetWidth;
  521.     y  = (IsMSMenu)? 
  522.          (idRow1.offsetHeight) :
  523.          (idRow1.offsetHeight + idRow2.offsetHeight + idRow3.offsetHeight);
  524.     thisMenu.style.top  = y;
  525.     thisMenu.style.left = x;
  526.     thisMenu.style.clip = "rect(0 0 0 0)";
  527.     thisMenu.style.display = "block";
  528.  
  529.     // delay 2 millsecond to allow the value of ToolbarMenu.offsetHeight be set
  530.     window.setTimeout("showMenu()", 2);
  531.     return true;
  532. }
  533.  
  534. function showMenu() 
  535. {
  536.     if (ToolbarMenu != null) 
  537.     { 
  538.         IsMenuDropDown = (Frame_Supported && IsMSMenu == false)? false : true;
  539.         if (IsMenuDropDown == false)
  540.         {
  541.             y = (y - ToolbarMenu.offsetHeight - idRow3.offsetHeight);
  542.             if (y < 0) y = 0;
  543.             ToolbarMenu.style.top = y;
  544.         }
  545.         y2 = y + ToolbarMenu.offsetHeight;
  546.  
  547.         ToolbarMenu.style.clip = "rect(auto auto auto auto)";
  548.         hideElement("SELECT");
  549.         hideElement("OBJECT");
  550.         hideElement("IFRAME");  //FRANKLO
  551.     }
  552. }
  553.  
  554. function hideMenu()
  555. {
  556.     if (ToolbarMenu != null && ToolbarMenu != StartMenu) 
  557.     {
  558.         // Don't hide the menu if the mouse move between the menu and submenus
  559.         cY = event.clientY + document.body.scrollTop;
  560.         if ( (event.clientX >= (x+5) && event.clientX <= x2) &&
  561.              ((IsMenuDropDown == true  && cY > (y-10) && cY <= y2)      ||
  562.               (IsMenuDropDown == false && cY >= y     && cY <= (y2+10)) ))
  563.         {
  564.             window.event.cancelBubble = true;
  565.             return; 
  566.         }
  567.  
  568.         ToolbarMenu.style.display = "none";
  569.         ToolbarMenu = StartMenu;
  570.         window.event.cancelBubble = true;
  571.  
  572.         showElement("SELECT");
  573.         showElement("OBJECT");
  574.         showElement("IFRAME"); //FRANKLO
  575.     }
  576. }
  577.  
  578. function hideElement(elmID)
  579. {
  580.     for (i = 0; i < document.all.tags(elmID).length; i++)
  581.     {
  582.         obj = document.all.tags(elmID)[i];
  583.         if (! obj || ! obj.offsetParent)
  584.             continue;
  585.  
  586.         // Find the element's offsetTop and offsetLeft relative to the BODY tag.
  587.         objLeft   = obj.offsetLeft;
  588.         objTop    = obj.offsetTop;
  589.         objParent = obj.offsetParent;
  590.         while (objParent.tagName.toUpperCase() != "BODY")
  591.         {
  592.             objLeft  += objParent.offsetLeft;
  593.             objTop   += objParent.offsetTop;
  594.             objParent = objParent.offsetParent;
  595.         }
  596.         // Adjust the element's offsetTop relative to the dropdown menu
  597.         objTop = objTop - y;
  598.  
  599.         if (x > (objLeft + obj.offsetWidth) || objLeft > (x + ToolbarMenu.offsetWidth))
  600.             ;
  601.         else if (objTop > ToolbarMenu.offsetHeight)
  602.             ;
  603.         else if (IsMSMenu && (y + ToolbarMenu.offsetHeight) <= 80)
  604.             ;
  605.         else
  606.             obj.style.visibility = "hidden";
  607.     }
  608. }
  609.  
  610. function showElement(elmID)
  611. {
  612.     for (i = 0; i < document.all.tags(elmID).length; i++)
  613.     {
  614.         obj = document.all.tags(elmID)[i];
  615.         if (! obj || ! obj.offsetParent)
  616.             continue;
  617.         obj.style.visibility = "";
  618.     }
  619. }
  620.  
  621. function formatURL(URLStr, InstrumentStr)
  622. {
  623.     var tempStr = URLStr;
  624.  
  625.     if (DoInstrumentation && URLStr != "" )
  626.     {
  627.         var ParamPos1 = URLStr.indexOf("?");
  628.         var ParamPos2 = URLStr.lastIndexOf("?");
  629.         var ParamPos3 = URLStr.toLowerCase().indexOf("target=");
  630.         var ParamPos4 = URLStr.indexOf("#");
  631.         var Bookmark  = "";
  632.         var URL = URLStr;
  633.         if (ParamPos4 >= 0)
  634.         {
  635.              URL = URLStr.substr(0, ParamPos4);
  636.             Bookmark = URLStr.substr(ParamPos4);
  637.         }
  638.         
  639.         if (ParamPos1 == -1)
  640.             tempStr = "?MSCOMTB=";
  641.         else if (ParamPos1 == ParamPos2 && ParamPos3 == -1)    
  642.             tempStr = "&MSCOMTB=";
  643.         else if (ParamPos1 == ParamPos2 && ParamPos3 != -1)    
  644.             tempStr = "?MSCOMTB=";
  645.         else if (ParamPos1 < ParamPos2)
  646.             tempStr = "&MSCOMTB=";
  647.  
  648.         tempStr = URL + tempStr + InstrumentStr.replace(" ","%20") + Bookmark;
  649.     }
  650.     return tempStr;
  651. }
  652.  
  653. function prepTrackingString(ts, type)
  654. {
  655.     var rArray;
  656.     var rString;
  657.     var pName = '';
  658.     if (0 == type)
  659.     {
  660.         pName = 'p=';
  661.         rString = ts.substring(1);
  662.         rArray = rString.split('/');
  663.     }
  664.     if (1 == type)
  665.     {
  666.         pName = 'qs=';
  667.         rString = ts.substring(1);
  668.         rArray = rString.split('&');        
  669.     }
  670.     if (2 == type)
  671.     {
  672.         pName = 'f=';
  673.         rString = escape(ts);
  674.         return pName + rString;
  675.     }
  676.     if (3 == type)
  677.     {
  678.         pName = 'tPage=';
  679.         rString = escape(ts);
  680.         return pName+rString;
  681.     }
  682.     if (4 == type)
  683.     {
  684.         pName = 'sPage=';
  685.         rString = escape(ts);
  686.         return pName + rString;
  687.     }
  688.     if (5 == type)
  689.     {
  690.         pName = 'r=';
  691.         rString = escape(ts);
  692.         return pName + rString;
  693.     }
  694.     if (6 == type)
  695.     {
  696.         pName = 'MSID=';
  697.         rString = escape(ts);
  698.         return pName + rString;
  699.     }
  700.     if (7 == type)
  701.     {
  702.         pName = 'source=';
  703.         rString = ts.toLowerCase();
  704.         if(rString.indexOf("microsoft.com") != -1)
  705.         {
  706.             rString = rString.substring(0,rString.indexOf("microsoft.com"));
  707.             if('' == rString)
  708.             {
  709.                 rString = "www";
  710.             }    
  711.             else
  712.             {
  713.                 rString = rString.substring(0,rString.length -1);
  714.             }
  715.         }
  716.         return pName + rString;
  717.     }
  718.     if (8 == type)
  719.     {
  720.         pName = 'TYPE=';
  721.         rString = escape(ts);
  722.         return pName + rString;
  723.     }
  724.     rString = '';
  725.     if(null != rArray)
  726.     {
  727.         if(0 == type)
  728.         {
  729.             for( j=0; j < rArray.length - 1; j++)
  730.             {    
  731.                 rString += rArray[j] + '_';  
  732.             } 
  733.         }
  734.         else
  735.         {
  736.             for( j=0; j < rArray.length  ; j++)
  737.             {
  738.                 rString += rArray[j] + '_';  
  739.             } 
  740.         }
  741.     }
  742.     rString = rString.substring(0, rString.length - 1);           
  743.     return pName + rString;
  744. }
  745.  
  746. function buildIMG(pArr)
  747. {
  748.     var TG = '<LAYER visibility="hide"><div style="display:none;"><IMG src="' + location.protocol + '//c.microsoft.com/trans_pixel.asp?';
  749.     for(var i=0; i<pArr.length; i++)
  750.     {
  751.         if(0 == i)
  752.         {
  753.             TG +=  pArr[i];
  754.         }
  755.         else
  756.         {
  757.             TG += '&' + pArr[i];
  758.         }
  759.     }
  760.     TG +='" height="0" width="0" hspace="0" vspace="0" Border="0"></div></layer>';
  761.     document.writeln(TG);
  762.     return;
  763. }
  764.  
  765.  
  766.